package com.googlecode.gwtbb.client.shared.entity.picture;

import com.googlecode.gwtbb.client.shared.entity.properties.HasCaption;
import com.googlecode.gwtbb.client.shared.entity.properties.HasSnapDate;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * @author Abraham Grief
 * @version $Id$
 * @since Jul 31, 2008
 */
public class PictureBase extends ImagePropertiesImpl implements HasCaption, HasSnapDate, Serializable {
	public static final String PICTURE_ID = "pictureId";

	public static final List<String> PROPERTIES = Collections.unmodifiableList(Arrays.asList(
		PICTURE_ID,
		URL,
		BYTES,
		WIDTH,
		HEIGHT,
		CAPTION,
		SNAP_DATE
	));
	// if any of these properties are different, then it's time to do an update
	public static final List<String> UPDATE_PROPERTIES = Collections.unmodifiableList(Arrays.asList(
		URL,
		BYTES,
		WIDTH,
		HEIGHT,
		CAPTION
	));
	// urls are stored instead of derived from the id to allow directory organization of the image files
	protected Long pictureId;
	protected String caption;
	protected Date snapDate;

	public PictureBase() {
	}

	public PictureBase(Long pictureId, String url, int bytes, int width, int height, String caption, Date snapDate) {
		super(url, bytes, width, height);
		this.pictureId = pictureId;
		this.caption = caption;
		this.snapDate = snapDate;
	}

	public String getCaption() {
		return caption;
	}

	public void setCaption(String caption) {
		this.caption = caption;
	}

	public Long getPictureId() {
		return pictureId;
	}

	public void setPictureId(Long pictureId) {
		this.pictureId = pictureId;
	}

	public Date getSnapDate() {
		return snapDate;
	}

	public void setSnapDate(Date snapDate) {
		this.snapDate = snapDate;
	}
}
